import { notFound } from "next/navigation"; import type { ReactNode } from "react"; import { api } from "@/lib/api"; /** * Existence check outside the loading boundary: a 404 from the API becomes a real HTTP 404 instead of a soft 404 * streamed after a 200 shell. The fetch is deduplicated with the page's own call (same URL, same revalidate). */ export default async function SourceLayout({ params, children }: { params: Promise<{ id: string }>; children: ReactNode }) { const { id } = await params; const r = await api.source(id); if (!r.ok && r.status === 404) notFound(); return <>{children}; }